<template>
   <div>
       <p>-----setup-----------</p>
       <p>ref-数据---{{msg}}</p>
       
       <button  @click="cson">使用子组件的方法</button>
       <p>-------------------------------------------------</p>
       <setupSon   :reacp='reacp'  ref='sref' @fromson='fromson' v-model:mo='mo' />
   </div>
</template>

<script setup lang='ts'>
    import {ref,onMounted,reactive,watch} from 'vue'
    import setupSon from '@/components/setupSon.vue'
    let msg=ref('数据一')
    let mo=ref('组件双向绑定数据')
    let reacp=reactive({
        data:"来自父组件",
        msg:'数据2'
    })
    let sref=ref()  //获取组件dom
    onMounted(()=>{
    //   console.log(sref,'子组件信息')
    })

    function fromson(data:string){
        msg=data
    }

    function cson(){
        sref.value.add()
    }

    watch(mo,(val:string)=>{
    })
</script>

<style>

</style>